<template>
	<view>
		个人中心
		<view style="width: 500rpx;height: 60rpx;background-color: aquamarine;border-radius: 30rpx;background-color: red;margin: auto;text-align: center;"
			@click.stop="switchRole">点击切换
		</view>
		<tabbar :selected="selectedNum" :isAdmin="isAdmin"></tabbar>
	</view>
</template>

<script>
	import tabbar from '../../../components/my_tabBar.vue'
	import { mapState, mapGetters, mapActions, mapMutations } from "vuex"
	export default {
		components: {
			tabbar
		},
		data() {
			return {
				selectedNum: 4,
				isAdmin:false
			}
		},
		onShow() {
			uni.hideTabBar({
				animation: false
			})
			this.isAdmin=uni.getStorageSync('role')==1?false:true;
		},
		methods: {
			switchRole() {
				uni.showLoading({
					title: '切换中~~~'
				});
				setTimeout(() => {
					if (uni.getStorageSync('role') == 1) {
						uni.setStorageSync('role', '2');
						this.isAdmin = true
						// this.showLoadingContent = '切换成管理员中....'
					} else {
						uni.setStorageSync('role', '1');
						this.isAdmin = false
						// this.showLoadingContent = '切换成陪诊/陪护师中....'
					}
					uni.hideLoading();
				}, 2000);
			},
		}
	}
</script>

<style>

</style>